home *** CD-ROM | disk | FTP | other *** search
Wrap
' ' Visual Basic Declarations of CRPE.DLL ' ===================================== ' ' File: GLOBAL.BAS ' ' Author: Crystal Computer Services, Inc. ' Date: 15 Apr 92 ' ' Purpose: This file presents the API to the Crystal Reports ' Print Engine DLL. ' ' Language: Visual Basic for Windows ' ' Copyright (c) 1992-1994 Crystal Services ' ' Revisions: ' ' CCS 15 Apr 92 - Original Development ' KYL 12 Jul 92 - Modified Existing Declarations ' Added Missing Declarations ' KYL 27 Aug 92 - Converted to CRPE.DLL ' CRD 08 Feb 93 - Added new calls for 2.0 and Global declares for samples ' CRD 25 Feb 93 - Added new calls for 2.0 Pro ' RBC 23 Apr 93 - Added more new calls, rearranged to match CRPE.H ' DVA 22 Dec 93 - Added new calls for 3.0 ' TW 15 Mar 94 - 3.0 call reorganization ' 'Mark's VB application specific Declarations '-------------------------------------------------------------------------------------------------- Declare Function GetWindow Lib "User" (ByVal hWnd As Integer, ByVal code As Integer) As Integer Declare Sub MoveWindow Lib "User" (ByVal hWnd As Integer, ByVal l As Integer, ByVal t As Integer, ByVal w As Integer, ByVal h As Integer, ByVal redraw As Integer) Global Const GW_CHILD = 5 Global Const CASCADE = 0 Global Const TILE_HORIZONTAL = 1 Global Const TILE_VERTICAL = 2 Global Const ARRANGE_ICONS = 3 Global jobnum As Integer Global TableN As Integer Global SortN As Integer Global FormulaName As String Global SectionCode As Integer Global ScopeCode As Integer Global CRWFontName As String Global CRWFontSize As Integer Global CRWFontItalic As Integer Global CRWFontUnderLine As Integer Global CRWFontStrikeThru As Integer Global ErrorCode As Integer Global FieldType As Integer Global SortDir As Integer Global BoolCond1 As Integer Global DateCond1 As Integer Global GroupCondfield As String ' Open, print and close report (used when no changes needed to report) ' -------------------------------------------------------------------- Declare Function PEPrintReport Lib "CRPE.DLL" (ByVal RptName$, ByVal Printer%, ByVal Window%, ByVal Title$, ByVal Lft%, ByVal Top%, ByVal Wdth%, ByVal Height%, ByVal Style As Long, ByVal PWindow%) As Integer ' Open and close print engine ' --------------------------- Declare Function PEOpenEngine Lib "CRPE.DLL" () As Integer Declare Sub PECloseEngine Lib "CRPE.DLL" () ' Get version info ' ---------------- Global Const PE_GV_DLL = 100 ' values for version parameter of PEGetVersion Global Const PE_GV_ENGINE = 200 Declare Function PEGetVersion Lib "CRPE.DLL" (ByVal version%) As Integer ' Open and close print job (i.e. report) ' -------------------------------------- Declare Function PEOpenPrintJob Lib "CRPE.DLL" (ByVal RptName$) As Integer Declare Sub PEClosePrintJob Lib "CRPE.DLL" (ByVal PrintJob%) ' Start and cancel print job (i.e. print the report, usually after changing report) ' --------------------------------------------------------------------------------- Declare Function PEStartPrintJob Lib "CRPE.DLL" (ByVal PrintJob%, ByVal WaitOrNot%) As Integer Declare Sub PECancelPrintJob Lib "CRPE.DLL" (ByVal PrintJob%) ' Print job status ' ---------------- Declare Function PEIsPrintJobFinished Lib "CRPE.DLL" (ByVal PrintJob%) As Integer Type PEJobInfo StructSize As Integer ' initialize to # of bytes in PEJobInfo NumRecordsRead As Long NumRecordsSelected As Long NumRecordsPrinted As Long DisplayPageN As Integer LatestPageN As Integer StartPageN As Integer PrintEnded As Integer End Type Declare Function PEGetJobStatus Lib "CRPE.DLL" (ByVal PrintJob%, JobInfo As PEJobInfo) As Integer ' Print job error codes and messages ' ---------------------------------- Declare Function PEGetErrorCode Lib "CRPE.DLL" (ByVal PrintJob%) As Integer Declare Function PEGetErrorText Lib "CRPE.DLL" (ByVal PrintJob%, TextHandle%, TextLength%) As Integer Declare Function PEGetHandleString Lib "CRPE.DLL" (ByVal TextHandle%, ByVal Buffer$, ByVal BufferLength%) As Integer ' Setting the print date ' ---------------------- Declare Function PESetPrintDate Lib "CRPE.DLL" (ByVal PrintJob%, ByVal Date_Year%, ByVal Date_Month%, ByVal Date_Day%) As Integer ' Controlling formulas, selection formulas and group selection formulas ' --------------------------------------------------------------------- Declare Function PEGetFormula Lib "CRPE.DLL" (ByVal PrintJob%, ByVal FormulaName$, TextHandle%, TextLength%) As Integer Declare Function PESetFormula Lib "CRPE.DLL" (ByVal PrintJob%, ByVal FormulaName$, ByVal FormulaString$) As Integer Declare Function PEGetSelectionFormula Lib "CRPE.DLL" (ByVal PrintJob%, TextHandle%, TextLength%) As Integer Declare Function PESetSelectionFormula Lib "CRPE.DLL" (ByVal PrintJob%, ByVal FormulaString$) As Integer Declare Function PEGetGroupSelectionFormula Lib "CRPE.DLL" (ByVal PrintJob%, TextHandle%, TextLength%) As Integer Declare Function PESetGroupSelectionFormula Lib "CRPE.DLL" (ByVal PrintJob%, ByVal FormulaString$) As Integer ' Controlling group conditions (i.e. group breaks) ' ------------------------------------------------ Global Const PE_GC_ANYCHANGE = 0 ' values for the Condition parameter of PESetGroupCondition ' use PE_ANYCHANGE for all field types except Date and Boolean Global Const PE_GC_DAILY = 0 ' use these constants for Date fields Global Const PE_GC_WEEKLY = 1 Global Const PE_GC_BIWEEKLY = 2 Global Const PE_GC_SEMIMONTHLY = 3 Global Const PE_GC_MONTHLY = 4 Global Const PE_GC_QUARTERLY = 5 Global Const PE_GC_SEMIANNUALLY = 6 Global Const PE_GC_ANNUALLY = 7 Global Const PE_GC_TOYES = 1 ' use these constants for Boolean fields Global Const PE_GC_TONO = 2 Global Const PE_GC_EVERYYES = 3 Global Const PE_GC_EVERYNO = 4 Global Const PE_GC_NEXTISYES = 5 Global Const PE_GC_NEXTISNO = 6 Declare Function PESetGroupCondition Lib "CRPE.DLL" (ByVal PrintJob%, ByVal SectionCode%, ByVal ConditionField$, ByVal Condition%, ByVal SortDirection%) As Integer ' Controlling sort order and group sort order ' ------------------------------------------- Global Const PE_SF_MAXNAMELEN = 50 ' maximum length of a sort field name Global Const PE_SF_DESC = 0 ' values for the Direction parameter Global Const PE_SF_ASC = 1 Declare Function PEGetNSortFields Lib "CRPE.DLL" (ByVal PrintJob%) As Integer Declare Function PEGetNthSortField Lib "CRPE.DLL" (ByVal PrintJob%, ByVal SortNumber%, NameHandle%, NameLength%, Direction%) As Integer Declare Function PESetNthSortField Lib "CRPE.DLL" (ByVal PrintJob%, ByVal SortNumber%, ByVal SortFieldName$, ByVal Direction%) As Integer Declare Function PEDeleteNthSortField Lib "CRPE.DLL" (ByVal PrintJob%, ByVal SortFieldN%) As Integer Declare Function PEGetNGroupSortFields Lib "CRPE.DLL" (ByVal PrintJob%) As Integer Declare Function PEGetNthGroupSortField Lib "CRPE.DLL" (ByVal PrintJob%, ByVal SortFieldN%, NameHandle%, NameLength%, Direction%) As Integer Declare Function PESetNthGroupSortField Lib "CRPE.DLL" (ByVal PrintJob%, ByVal SortFieldN%, ByVal SortGroupName$, ByVal Direction%) As Integer Declare Function PEDeleteNthGroupSortField Lib "CRPE.DLL" (ByVal PrintJob%, ByVal SortFieldN%) As Integer ' Controlling databases (see CRPE.H for more comments) ' ---------------------------------------------------- Declare Function PEGetNTables Lib "CRPE.DLL" (ByVal PrintJob%) As Integer Global Const PE_DLL_NAME_LEN = 64 Global Const PE_FULL_NAME_LEN = 256 Type PETableType StructSize As Integer ' initialize to # bytes in PETableType DLLName As String * PE_DLL_NAME_LEN DescriptiveName As String * PE_FULL_NAME_LEN DBType As Integer End Type Global Const PE_DT_STANDARD = 1 ' values for DBType Global Const PE_DT_SQL = 2 Declare Function PEGetNthTableType Lib "CRPE.DLL" (ByVal PrintJob%, ByVal TableN%, TableType As PETableType) As Integer Global Const PE_LONGPTR_LEN = 4 Global Const PE_SESS_USERID_LEN = 128 Global Const PE_SESS_PASSWORD_LEN = 128 Type PESessionInfo StructSize As Integer 'initialize to # bytes in PESessionInfo UserID As String * PE_SESS_PASSWORD_LEN Password As String * PE_SESS_PASSWORD_LEN SessionHandle As Long End Type Declare Function PEGetNthTableSessionInfo Lib "CRPE.DLL" (ByVal PrintJob%, ByVal TableN%, SessionInfo As PESessionInfo) As Integer Declare Function PESetNthTableSessionInfo Lib "CRPE.DLL" (ByVal PrintJob%, ByVal TableN%, SessionInfo As PESessionInfo, ByVal PropagateAcrossTables%) As Integer Global Const PE_SERVERNAME_LEN = 128 Global Const PE_DATABASENAME_LEN = 128 Global Const PE_USERID_LEN = 128 Global Const PE_PASSWORD_LEN = 128 Type PELogonInfo StructSize As Integer ' initialize to # bytes in PELogOnInfo ' For any of the following values an empty string ("") means to use ' the value already set in the report. To override a value in the ' report use a non-empty string (e.g. "Server A"). All strings are ' null-terminated. ' For Netware SQL, pass the dictionary path name in ServerName and ' data path name in DatabaseName. ServerName As String * PE_SERVERNAME_LEN DatabaseName As String * PE_DATABASENAME_LEN UserID As String * PE_USERID_LEN ' Password is undefined when getting information from report. Password As String * PE_PASSWORD_LEN End Type Declare Function PEGetNthTableLogonInfo Lib "CRPE.Dll" (ByVal PrintJob%, ByVal TableN%, LogOnInfo As PELogonInfo) As Integer Declare Function PESetNthTableLogonInfo Lib "CRPE.Dll" (ByVal PrintJob%, ByVal TableN%, LogOnInfo As PELogonInfo, ByVal Propagate%) As Integer Global Const PE_TABLE_LOCATION_LEN = 256 Type PETableLocation StructSize As Integer ' initialize to # bytes in PETableLocation ' String is null-terminated. Location As String * PE_TABLE_LOCATION_LEN End Type Declare Function PEGetNthTableLocation Lib "CRPE.Dll" (ByVal PrintJob%, ByVal TableN%, Location As PETableLocation) As Integer Declare Function PESetNthTableLocation Lib "CRPE.Dll" (ByVal PrintJob%, ByVal TableN%, Location As PETableLocation) As Integer Declare Function PETestNthTableConnectivity Lib "CRPE.Dll" (ByVal PrintJob%, ByVal TableN%) As Integer Declare Function PELogOnServer Lib "CRPE.Dll" (ByVal DLLName$, LogOnInfo As PELogonInfo) As Integer Declare Function PELogOFFServer Lib "CRPE.Dll" (ByVal DLLName$, LogOnInfo As PELogonInfo) As Integer Declare Function PEGetNFiles Lib "CRPE.DLL" (ByVal PrintJob%) As Integer Declare Function PEGetNthFileName Lib "CRPE.DLL" (ByVal PrintJob%, ByVal FileN%, NameHandle%, NameLength%) As Integer Declare Function PESetNthFileName Lib "CRPE.DLL" (ByVal PrintJob%, ByVal FileN%, ByVal Set_Name$) As Integer ' Overriding SQL query in report ' ------------------------------ Declare Function PEGetSQLQuery Lib "CRPE.DLL" (ByVal PrintJob%, TextHandle%, TextLength%) As Integer Declare Function PESetSQLQuery Lib "CRPE.DLL" (ByVal PrintJob%, ByVal QueryString$) As Integer ' Refreshing saved data ' --------------------- Declare Function PESetRefreshData Lib "CRPE.DLL" (ByVal PrintJob%, ByVal RefreshData%) As Integer ' Report title ' ------------ Declare Function PEGetReportTitle Lib "CRPE.DLL" (ByVal PrintJob%, TitleHandle%, TitleLength%) As Integer Declare Function PESetReportTitle Lib "CRPE.DLL" (ByVal PrintJob%, ByVal Title$) As Integer ' Controlling printed pages ' ------------------------- Declare Function PEShowNextPage Lib "CRPE.DLL" (ByVal PrintJob%) As Integer Declare Function PEShowFirstPage Lib "CRPE.DLL" (ByVal PrintJob%) As Integer Declare Function PEShowPreviousPage Lib "CRPE.DLL" (ByVal PrintJob%) As Integer Declare Function PEShowLastPage Lib "CRPE.DLL" (ByVal PrintJob%) As Integer Declare Function PEShowPrintControls Lib "CRPE.DLL" (ByVal PrintJob%, ByVal ShowPrintControls%) As Integer ' Changing printer selection ' -------------------------- Declare Function PESelectPrinter Lib "CRPE.DLL" (ByVal PrintJob%, ByVal PrinterDriver$, ByVal PrinterName$, ByVal PortName$, ByVal DevMode As Long) As Integer ' Controlling print to printer ' ---------------------------- Declare Function PEOutputToDefaultPrinter Lib "CRPE.DLL" (ByVal PrintJob%, ByVal NCopies%) As Integer Declare Function PEOutputToPrinter Lib "CRPE.DLL" (ByVal PrintJob%, ByVal NCopies%) As Integer Declare Function PESetNDetailCopies Lib "CRPE.DLL" (ByVal PrintJob%, ByVal nDetailCopies%) As Integer Global Const PE_MAXPAGEN = 65535 Type PEPrintOptions StructSize As Integer ' initialize to # bytes in PEPrintOptions ' page and copy numbers are 1-origin ' use 0 to preserve the existing settings StartPageN As Integer stopPageN As Integer nReportCopies As Integer collation As Integer End Type ' values for collation Global Const PE_UNCOLLATED = 0 Global Const PE_COLLATED = 1 Global Const PE_DEFAULTCOLLATION = 2 Declare Function PESetPrintOptions Lib "CRPE.Dll" (ByVal PrintJob%, Options As PEPrintOptions) As Integer ' Controlling print to window ' --------------------------- Declare Function PEOutPutToWindow Lib "CRPE.DLL" (ByVal PrintJob%, ByVal Title$, ByVal Lft%, ByVal Top%, ByVal Wdth%, ByVal Height%, ByVal Style As Long, ByVal PWindow%) As Integer Declare Function PEGetWindowHandle Lib "CRPE.DLL" (ByVal PrintJob%) As Integer Declare Function PEPrintWindow Lib "CRPE.Dll" (ByVal PrintJob%, ByVal WaitNoWait%) As Integer Declare Sub PECloseWindow Lib "CRPE.DLL" (ByVal PrintJob%) ' Controlling print to file and export ' ------------------------------------ ' Types for the Options parameter of PEOutputToFile ' Use for all types except PE_FT_CHARSEPARATED Type PEPrintFileOptions StructSize As Integer ' initialize to # of bytes in PEPrintFileOptions UseReportNumberFmt As Integer UseReportDateFormat As Integer End Type Global Const PE_FIELDDELIMLEN = 17 ' Use for PE_FT_CHARSEPARATED Type PECharSepFileOptions StructSize As Integer ' initialize to # of bytes in PECharSepFileOptions UseReportNumberFmt As Integer UseReportDateFormat As Integer StringDelimiter As String * 1 FieldDelimiter As String * PE_FIELDDELIMLEN End Type ' values for FileType Global Const PE_FT_RECORD = 0 Global Const PE_FT_TABSEPARATED = 1 Global Const PE_FT_TEXT = 2 Global Const PE_FT_DIF = 3 Global Const PE_FT_CSV = 4 Global Const PE_FT_CHARSEPARATED = 5 Global Const PE_FT_TABFORMATTED = 6 Declare Function PEOutputToFile Lib "CRPE.DLL" (ByVal PrintJob%, ByVal OutputFilePath$, ByVal FileType%, Options As Any) As Integer Type PEExportOptions StructSize As Integer 'initialize to # bytes in PEExportOptions FormatDLLName As String * PE_DLL_NAME_LEN FormatType As Long FormatOptions As Long DestinationDLLName As String * PE_DLL_NAME_LEN DestinationType As Long DestinationOptions As Long NFormatOptionsBytes As Integer NDestinationOptionsBytes As Integer End Type Declare Function PEGetExportOptions Lib "CRPE.DLL" (ByVal PrintJob%, ExportOptions As PEExportOptions) As Integer Declare Function PEExportTo Lib "CRPE.DLL" (ByVal PrintJob%, ExportOptions As PEExportOptions) As Integer ' Setting page margins ' -------------------- Declare Function PESetMargins Lib "CRPE.DLL" (ByVal PrintJob%, ByVal LeftMargin%, ByVal RightMargin%, ByVal TopMargin%, ByVal BottomMargin%) As Integer ' Setting section height and format ' --------------------------------- ' values for SectionCode parameter Global Const PE_ALLSECTIONS = 0 Global Const PE_HEADERSECTION = 2000 Global Const PE_GROUPHEADER = 3000 ' outer group header is 3000, next is 3001, etc. Global Const PE_DETAILSECTION = 4000 Global Const PE_GROUPFOOTER = 5000 ' outer group footer is 5000, next is 5001, etc. Global Const PE_GRANDTOTALSECTION = 6000 Global Const PE_FOOTERSECTION = 7000 ' MinimumHeight is in twips - 1440 twips to the inch Declare Function PESetMinimumSectionHeight Lib "CRPE.DLL" (ByVal PrintJob%, ByVal SectionCode%, ByVal MinimumHeight%) As Integer Type PESectionOptions StructSize As Integer ' initialize to # bytes in PESectionOptions ' use 0 to turn off, 1 to turn on and -1 to preserve each attribute Visible As Integer NewPageBefore As Integer NewPageAfter As Integer KeepTogether As Integer SuppressBlankLines As Integer ResetPageNAfter As Integer PrintAtBottomOfPage As Integer End Type Declare Function PESetSectionFormat Lib "CRPE.DLL" (ByVal PrintJob%, ByVal SectionCode%, Options As PESectionOptions) As Integer ' Setting line height ' ------------------- ' use PE_ALLLINES to set the height of all lines in a section Global Const PE_ALLLINES = -1 ' Height and Ascent are in twips Declare Function PESetLineHeight Lib "CRPE.DLL" (ByVal PrintJob%, ByVal SectionCode%, ByVal LineN%, ByVal Height%, ByVal Ascent%) As Integer ' Setting font info ' ----------------- ' values for ScopeCode - may be ORed together Global Const PE_FIELDS = 1 Global Const PE_TEXT = 2 ' use for isItalic, isUnderlined, or isStruckOut to preserve the existing value Global Const PE_UNCHANGED = -1 Declare Function PESetFont Lib "CRPE.DLL" (ByVal PrintJob%, ByVal SectionCode%, ByVal ScopeCode%, ByVal FaceName$, ByVal FontFamily%, ByVal FontPitch%, ByVal CharSet%, ByVal PointSize%, ByVal isItalic%, ByVal isUnderlined%, ByVal isStruckOut%, ByVal Weight%) As Integer ' End Of Declarations